// 
//  dmap-query.vala
//  
//  Author:
//       Alexandre Rosenfeld <alexandre.rosenfeld@gmail.com>
//  
//  Copyright (c) 2011 Alexandre Rosenfeld
// 
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
// 
//  You should have received a copy of the GNU Lesser General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

namespace mShare.DMAP {
	class Query : Object {
		public bool parse(string query) {
			return false;
			// The query string is divided in groups of AND separated by a space,
			// each group containing queries of OR separated by comma enclosed in
			// parentheses. Queries are key, value pairs separated by ':' enclosed 
			// in quotes or not.
			// The result from this is a list of lists. Here is an example:
			// String is ('com.apple.itunes.mediakind:1','com.apple.itunes.mediakind:32') 'daap.songartist!:'
			// list:
			// |-> filter1: -> com.apple.itunes.mediakind = 1
			// |   |        -> com.apple.itunes.mediakind = 32
			// |-> filter1: -> daap.songartist! = (null)
			// This basically means that the query is (filter1 AND filter2), and
			// filter1 is (com.apple.itunes.mediakind = 1) OR (com.apple.itunes.mediakind = 32)
			
			/*
			var scanner = new GLib.Scanner(null);
			scanner.config.scan_identifiers = false;
			scanner.config.scan_octal = false;
			scanner.config.scan_float = false;
			scanner.config.identifier_2_string = true;
			scanner.config.cset_skip_characters = null;
			
			scanner.input_text(query);
			
			cur_filter = null;
			cur_query = null;
			
			while (!scanner.eof()) {
				switch (scanner.get_next_token()) {
					case LEFT_PARAN:
						
				}
			}*/
			
		}
	}
	
}